package com.zhen.strategy.web;

import com.zhen.strategy.domain.PaymentContext;
import com.zhen.strategy.service.BusiService;
import com.zhen.strategy.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class OrderController {
    @Autowired
    OrderService orderService;
    @Autowired
    BusiService busiService;

    @PostMapping("/callOrder")
    public void callOrder() {
        log.info("OrderController.callOrder开始执行");
        PaymentContext context = new PaymentContext();
        context.setMMoney(12.34);
        context.setBusiType("order");
        context.setMUserName("zhangsan");
        context.setStrategy("orderStrategy");
        orderService.callOrder(context);
    }

    @PostMapping("/callOrder2")
    public String callOrder2(String para) {
        return busiService.call(para, "order");
    }
}
